<template>
  <div class="">
    <!-- isOpenJoinAgent: -1:无门槛, 1:最低门槛, 2:任意门槛; isAgent: 0不是服务商、股东、区域代理, 1是;isApply: 1有未审核的申请记录。0没有这种记录-->
    <div class="c-p" :class="upAgent.isOpenJoinAgent == -1 ? '' : 'c-pb20'" v-if="upAgent && (upAgent.isOpenJoinAgent > 0 || upAgent.isOpenJoinAgent == -1) && upAgent.isAgent == 0 && upAgent.isApply == 0 && otherJoinType == 0 && upAgent.recruitDesc">
      <div class="tinymce-text c-lh36 c-fc-sblack c-ww-bw c-ww-ba c-bg-xblue" :class="upAgent.isOpenJoinAgent > 0 && !showAllContent ? 'c-hh280 c-text-hidden' : 'c-contexty-scroll'" :style="{'background-color': upAgent.backcolor, 'padding': '0 '+upAgent.margin+'px'}" v-html="upAgent.recruitDesc"></div>
      <div @click="clickShowMore" class="c-mh24 c-fs20 c-pv30 c-bg-white theme-fc c-textAlign-c c-bd-b1-f5" v-if="upAgent.isOpenJoinAgent > 0">
        <span>{{showAllContent ? '收起全部内容':'展开全部内容'}}<span class="c-fs20 theme-fc icon iconfont c-ml12">{{showAllContent ? "&#xe712;" : "&#xe714;"}}</span></span>
      </div>
      <!-- 服务商、股东、区域代理申请页共用该页面, 目前只有服务商支持协议(protocolInfo)-->
      <div class="c-bd-t1 c-pf c-p-b0 c-w100 c-maxw640 c-bg-white c-pz100 c-ph24 c-flex-column c-justify-sa box-shadow" v-if="upAgent.isOpenJoinAgent == -1" :class="protocolInfo && !fromType ? '' : 'c-hh88'">
        <div class="c-pv16 c-fs22 c-lh28" @click="isCheckAgreement = !isCheckAgreement" v-if="protocolInfo && !fromType">
          <span class="iconfont c-fs26 c-lh42 c-pr16" :class="isCheckAgreement ? 'theme-fc' : 'c-fc-gray'">{{isCheckAgreement ? '&#xe796;' : '&#xe6f7;'}}</span>
          <span>我已阅读并同意以上规则以及 <span class="theme-fc" @click.stop="clickProtocol(item)" v-for="(item, index) in protocolInfo" :key="index">《{{item.name}}》</span></span>
        </div>
        <div :class="protocolInfo && !fromType ? 'c-hh88' : ''">
          <div @click="changeOpenAgent" class="c-fc-white c-br36 c-textAlign-c c-hh64 c-ph10 theme-bg c-fs26 c-lh64">申请为{{fromType == 'areaAgent' ? '区域代理' : fromType == 'shareholder' ? upAgent.agentName :  customName.serviceProviderName}}</div>
        </div>
      </div>
    </div>
    <div class="c-bg-white c-minh720" v-if="upAgent && upAgent.isOpenJoinAgent > 0 && upAgent.isAgent == 0 && upAgent.isApply == 0 && otherJoinType == 0">
      <div class="c-ph24" v-if="upAgent.isOpenJoinAgent == 1">
        <!-- 最低门槛 -->
        <div class="c-fs26 c-fc-xblack c-textAlign-c c-pv40">- 成为{{customName.agentName}}条件 -</div>
        <div class="c-bg-sgray c-br10 c-w100 c-ph20">
          <div class="c-flex-row c-justify-sb c-pv40">
            <div class="c-flex-row c-aligni-center">
              <img :src="require('@/assets/i/wap/common/buy.png')" class="c-ww40 c-hh40"/>
              <span class="c-fc-xblack c-fs24 c-ml20">{{upAgent.joinType == 1 ? "购买任意产品" : "购买以下任一指定产品"}}</span>
            </div>
            <div class="c-ph24 c-pv8 c-fs18 c-br20 c-fc-white" :class="upAgent.isFinish == 0 ? 'theme-bg-gradient' : 'c-bg-ccc'" @click="goProductDetail('/', 0)" v-if="upAgent.joinType == 1 || upAgent.isFinish == 1">{{upAgent.isFinish == 0 ? "去完成" : "已完成"}}</div>
          </div>
          <div class="c-bd-t1-mgray c-pb30" v-if="upAgent.joinType == 2 && upAgent.isFinish == 0 && upAgent.allProd.length > 0">
            <div class="c-pt30" v-for="(item, index) in upAgent.allProd" :key="index" @click="goProductDetail(item.url, 1)">
              <div class="c-flex-row c-justify-sb c-aligni-center">
                <div class="c-flex-row c-w0 c-flex-grow1">
                  <img :src="$addXossFilter(item.cover, require('../../../assets/defult270.png'))" class="c-ww120 c-hh80 c-br10"/>
                  <div class="c-flex-column c-hh80 c-justify-sa c-ml10 c-w0 c-flex-grow1">
                    <span class="c-text-ellipsis1 c-fs24 c-fc-xblack">{{item.name}}</span>
                    <span class="c-fs22 theme-fc">{{item.payType | priceValueFilter(item.price, item.prodType)}}</span>
                  </div>
                </div>
                <div class="c-ph24 c-pv8 c-fs18 c-br20 c-fc-white theme-bg-gradient">去完成</div>
              </div>
              <div v-if="item.prodType == ckFrom.activity && item.ticketName" class="c-fs22 c-fc-gray pl130 c-mt16">需购买指定票种：{{item.ticketName}}</div>
            </div>
          </div>
        </div>
      </div>
      <div v-else>
        <!-- 任意门槛 -->
        <div v-for="(item, index) in upAgent.agentLevelRules.agentLevelRules" :key="index" class="c-ph24">
          <div class="c-fs26 c-fc-xblack c-textAlign-c c-pv40">- 成为{{item.name}}条件 -</div>
          <div class="c-bg-sgray c-br10 c-w100 c-ph20">
            <div class="c-flex-row c-justify-sb c-pv40">
              <div class="c-flex-row c-aligni-center">
                <img :src="require('@/assets/i/wap/common/buy.png')" class="c-ww40 c-hh40"/>
                <span class="c-fc-xblack c-fs24 c-ml20">购买以下任一指定产品</span>
              </div>
              <div class="c-ph24 c-pv8 c-fs18 c-br20 c-fc-white" :class="item.isFinish == 0 ? 'theme-bg-gradient' : 'c-bg-ccc'" @click="goProductDetail('/', 0)" v-if="item.isFinish == 1">已完成</div>
            </div>
            <div class="c-bd-t1-mgray c-pb30" v-if="item.isFinish == 0 && item.prods.length > 0">
              <div class="c-pt30" v-for="(item, index) in item.prods" :key="index" @click="goProductDetail(item.url, 1)">
                <div class="c-flex-row c-justify-sb c-aligni-center">
                  <div class="c-flex-row c-w0 c-flex-grow1">
                    <img :src="$addXossFilter(item.cover, require('../../../assets/defult270.png'))" class="c-ww120 c-hh80 c-br10"/>
                    <div class="c-flex-column c-hh80 c-justify-sa c-ml10 c-w0 c-flex-grow1">
                      <span class="c-text-ellipsis1 c-fs24 c-fc-xblack">{{item.name}}</span>
                      <span class="c-fs22 theme-fc">{{item.payType | priceValueFilter(item.price, item.prodType)}}</span>
                    </div>
                  </div>
                  <div class="c-ph24 c-pv8 c-fs18 c-br20 c-fc-white theme-bg-gradient">去完成</div>
                </div>
                <div v-if="item.prodType == ckFrom.activity && item.ticketName" class="c-fs22 c-fc-gray pl130 c-mt16">需购买指定票种：{{item.ticketName}}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="c-pt20 c-pb40 c-fs22 c-fc-sblack c-textAlign-c" ref="upgradeTip">您{{upAgent.isFinish == 0 ? "未满足条件，不" : "已满足条件，"}}可申请成为{{customName.serviceProviderName}}</div>
      <div class="c-bd-t1 c-pf c-p-b0 c-w100 c-maxw640 c-bg-white c-pz100 c-ph24 c-flex-column c-justify-sa box-shadow">
        <div class="c-pv16 c-fs22 c-lh28" @click="isCheckAgreement = !isCheckAgreement" v-if="protocolInfo" ref="agreement">
          <span class="iconfont c-fs26 c-lh42 c-pr16" :class="isCheckAgreement ? 'theme-fc' : 'c-fc-gray'">{{isCheckAgreement ? '&#xe796;' : '&#xe6f7;'}}</span>
          <span>我已阅读并同意以上规则以及 <span class="theme-fc" @click.stop="clickProtocol(item)" v-for="(item, index) in protocolInfo" :key="index">《{{item.name}}》</span></span>
        </div>
        <div class="c-flex-row c-justify-sb c-aligni-center c-hh88">
          <div @click="clickOtherJion()" class="c-br36 c-fs24 c-textAlign-c c-hh64 c-lh64 theme-fc theme-bd1 c-ph18 c-mr12" v-if="[2, 3, 6, 7].includes(upAgent.confStatus)">其他方式加入</div>
          <div @click="clickNext()" class="c-fc-white c-br36 c-textAlign-c c-hh64 c-ph10 c-w0 c-flex-grow1" :class="[upAgent.isFinish == 0 ? 'c-bg-ccc' : 'theme-bg', upAgent.joinType == 2 && upAgent.isFinish == 0 && customName.serviceProviderName.length >= 5 ? 'c-fs24' : 'c-fs24 c-lh64']">{{upAgent.isFinish == 1 ? "申请为" : '满足条件后，才可申请为'}}{{customName.serviceProviderName}}</div>
        </div>
      </div>
    </div>
    <template v-if="otherJoinType == 1 || (upAgent && (upAgent.isAgent == 1 || upAgent.isApply == 1 || upAgent.isOpenJoinAgent == 0))">
      <div class="c-bg-sgray c-p" :class="fromType == '' ? '' : 'c-h100vh'" v-if="isShowPartner">
        <div class="c-pa c-p-t0 c-p-l0 c-w100 c-maxw640 c-hh46" v-if="fromType == 'shareholder' && partnerData.sStatus == -10">
          <div class="c-fs22 c-lh46 c-hh46 c-fc-white c-pl24 c-pa c-p-t0 c-p-l0 c-pz6">温馨提示：您的股东权限已被禁用，分享不能继续获得收益</div>
          <div class="c-bg-black c-w100 c-maxw640 c-hh46 c-pa c-p-t0 c-p-l0" style="opacity: .5;"></div>
        </div>
        <div class="c-hh300 c-w100 bg-agent-top c-ph24 c-pt26 c-flex-column">
          <div class="c-flex-row c-h0 c-flex-grow1">
            <img :src="$addXossFilter(memberInfo.avatar, require('@/assets/defult_head.png'))" class="c-ww100 c-hh100 c-brp50 c-bd1-white"/>
            <div class="c-w0 c-flex-grow1 c-flex-column c-justify-sb c-ml20 c-pv4 c-hh100">
              <div class="c-flex-row c-aligni-center">
                <span class="c-fs30 c-fc-white c-fw500">{{memberInfo.nickname && memberInfo.nickname.length > 6 ? (memberInfo.nickname.substring(0, 6) + '...') : memberInfo.nickname}}</span>
                <identity-com class="c-pl10" :fromType="fromType" :vipType="memberInfo.vipType" :shareholderType="memberInfo.type" :arrAgentName="arrAgentName"></identity-com>
              </div>
              <div class="c-flex-row c-aligni-center">
                <div class="c-fs24 c-fc-white">ID：{{memberInfo.userId}}</div>
                <div @click="copyText(memberInfo.userId)" class="c-ww48 c-hh24 c-flex-row c-flex-center c-br14 c-fc-white c-bd1-white c-ml20 c-fs16">复制</div>
              </div>
            </div>
          </div>
          <div class="c-w100 c-hh144 bg-agent-time c-pt34 c-ph28">
            <div class="c-fs24 c-fc-xlblown">升级时间：<span class="c-fc-xlblown">{{partnerData.auditAt}}</span></div>
            <div class="c-fs24 c-fc-xlblown c-mt12" v-if="fromType == '' && agentConf">到期时间：<span class="c-fc-xlblown">{{agentConf.expire ? agentConf.expire.split(" ")[0] : '永久有效'}}</span> <span class="c-fc-white c-fs20 theme-bg c-ph10 c-pv5 c-br4 c-ml10" v-if="agentConf.expire && agentConf.status != 4 && isDying" @click.stop.prevent="isShowRenew = true;">立即续期</span></div>
          </div>
        </div>
        <!-- <div class="c-p">
          <div class="c-pa c-p-t0 c-p-l0 c-w100 c-maxw640 c-hh46" v-if="fromType == 'shareholder' && partnerData.sStatus == -10">
            <div class="c-fs22 c-lh46 c-hh46 c-fc-white c-pl24 c-pa c-p-t0 c-p-l0 c-pz6">温馨提示：您的股东权限已被禁用，分享不能继续获得收益</div>
            <div class="c-bg-black c-w100 c-maxw640 c-hh46 c-pa c-p-t0 c-p-l0" style="opacity: .2;"></div>
          </div>
          <div class="c-ph24 c-w100 c-maxw640" :class="fromType == 'shareholder' && partnerData.sStatus == -10 ? 'c-pt68' : 'c-pt40'">
            <div class="c-flex-row c-justify-sb c-pt40 c-pb48 c-bg-white c-br20 c-ph30" @click="clickItem(1)">
              <div class="c-flex-column">
                <div class="c-flex-row c-aligni-center">
                  <span class="c-fs30 c-fc-xblak">{{memberInfo.nickname && memberInfo.nickname.length > 6 ? (memberInfo.nickname.substring(0, 6) + '...') : memberInfo.nickname}}</span>
                  <identity-com class="c-pl10" :fromType="fromType" :vipType="memberInfo.vipType" :shareholderType="memberInfo.type" :arrAgentName="arrAgentName"></identity-com>
                </div>
                <span class="c-fs20 c-fc-gray c-mt20">ID：<span class="c-fc-xblack">{{memberInfo.userId}}</span></span>
                <span class="c-fs20 c-fc-gray c-mt20">升级时间：<span class="c-fc-xblack">{{partnerData.auditAt}}</span></span>
                <span class="c-fs20 c-fc-gray c-mt20" v-if="fromType == '' && agentConf">到期时间：<span class="c-fc-xblack">{{agentConf.expire ? agentConf.expire.split(" ")[0] : '永久有效'}}</span> <span class="c-fc-white c-fs20 theme-bg c-ph10 c-pv5 c-br4 c-ml10" v-if="agentConf.expire && agentConf.status != 4 && isDying" @click.stop.prevent="isShowRenew = true;">立即续期</span></span>
              </div>
              <img :src="$addXossFilter(memberInfo.avatar, require('@/assets/defult_head.png'))" class="c-ww120 c-hh120 c-brp50"/>
            </div>
          </div>
        </div> -->
        <div class="c-bg-white c-br20 c-pv24 c-mh24 c-flex-row c-justify-sa c-aligni-center c-mt20" v-if="fromType == 'shareholder'">
          <div class="c-flex-column c-aligni-center c-w48">
            <span class="c-fs32 c-fw-b">{{memberInfo.totalIncome}}</span>
            <span class="c-mt6 c-fs20 c-fc-gray">已结算(元)</span>
          </div>
          <div class="c-hh36 c-opacity60" style="width:0.05rem;border: 1px solid #e5e5e5;"></div>
          <div class="c-flex-column c-aligni-center c-w48">
            <span class="c-fs32 c-fw-b">{{memberInfo.balance}}</span>
            <div class="c-mt6 c-fs20 c-fc-gray">可提现(元) <span class="theme-fc theme-bd1 c-fs18 c-br20 c-ph12 c-pv2" @click="goWithdraw()">去提现</span></div>
          </div>
        </div>
        <div :class="fromType == 'shareholder' ? 'c-mt20 c-br20' : 'c-br-bl20 c-br-br20'" class="c-bg-white c-pb30 c-mh24" v-if="fromType == ''">
          <div class="c-ph30 c-fs28 c-fw-500 c-fc-xblack c-pt30 c-pb8">资产管理</div>
          <div class="c-flex-row c-flexw-wrap">
            <div v-if="!isHiddenAgent" class="c-w25 c-flex-column c-aligni-center c-mt22" @click="goIncome">
              <img :src="require('@/assets/i/wap/newAreaAgent/couponMg2.png')" class="c-ww60 c-hh60"/>
              <span class="c-fs20 c-fc-xblack c-mt8">我的奖励</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(2)">
              <img :src="require('@/assets/i/wap/newAreaAgent/nameMg2.png')" class="c-ww60 c-hh60"/>
              <span class="c-fs20 c-fc-xblack c-mt8">名额管理</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem('amount')">
              <img :src="require('@/assets/i/wap/newAreaAgent/amount2.png')" class="c-ww60 c-hh60"/>
              <span class="c-fs20 c-fc-xblack c-mt8">{{agentConf && agentConf.amountManagementName ? agentConf.amountManagementName : '金额管理'}}</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(4)">
              <img :src="require('@/assets/i/wap/newAreaAgent/presentRecord2.png')" class="c-ww60 c-hh60"/>
              <span class="c-fs20 c-fc-xblack c-mt8">赠送记录</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(5)">
              <img :src="require('@/assets/i/wap/newAreaAgent/consumeInfo2.png')" class="c-ww60 c-hh60"/>
              <span class="c-fs20 c-fc-xblack c-mt8">消耗明细</span>
            </div>
          </div>
        </div>
        <div class="c-bg-white c-mt20 c-br20 c-pb30 c-mh24" v-if="fromType == '' && !isHiddenAgent">
          <div class="c-ph30 c-fs28 c-fw-500 c-fc-xblack c-pt30 c-pb8">团队管理</div>
          <div class="c-flex-row c-flexw-wrap">
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(10)">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe6c9;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">我的团队</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(6)">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe849;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">团队业绩</span>
            </div>
          </div>
        </div>
        <div class="c-bg-white c-mt20 c-br20 c-pb30 c-mh24" v-if="fromType == ''">
          <div class="c-ph30 c-fs28 c-fw-500 c-fc-xblack c-pt30 c-pb8">推广中心</div>
          <div class="c-flex-row c-flexw-wrap">
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(3)">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe649;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">{{agentConf && agentConf.promoteMoneyName ? agentConf.promoteMoneyName : '好物分享'}}</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt22" @click="clickItem(7)">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe709;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">招募计划</span>
            </div>
            <div v-if="agentApplyConf && agentApplyConf.isAutoUpgrade == 1 && memberInfo.isMaxLevel != 1 && agentApplyConf.isShowUpgrade == 1" class="c-w25 c-flex-column c-aligni-center c-mt24" @click="clickItem(9)">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe645;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">晋升条件</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt24" @click="goRelatedIncomeProds">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe731;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">关联商品</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt24" v-if="isPromotion" @click="goWxecshopList">
              <span class="iconfont c-fs34 c-fc-xblack">&#xe7a0;</span>
              <span class="c-fs20 c-fc-xblack c-mt12">推广视频号</span>
            </div>
          </div>
        </div>
        <div class="c-bg-white c-mt20 c-br20 c-pb48 c-mh24" v-if="fromType == 'shareholder'">
          <div class="c-flex-row c-flexw-wrap">
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" @click="clickShareholder(1)">
              <img :src="require('@/assets/i/wap/newAreaAgent/spreadEduCourse.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">推广</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" @click="clickShareholder(7)">
              <img :src="require('@/assets/i/wap/newAreaAgent/nameMg.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">名额管理</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" @click="clickShareholder(0)">
              <img :src="require('@/assets/i/wap/newAreaAgent/teamMg.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">我的客户</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" @click="clickShareholder(5)">
              <img :src="require('@/assets/i/wap/newAreaAgent/recruit.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">招募计划</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" @click="clickShareholder(3)">
              <img :src="require('@/assets/i/wap/newAreaAgent/consumeInfo.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">收入明细</span>
            </div>
            <div class="c-w25 c-flex-column c-aligni-center c-mt36" v-if="agentConf.isAreaAgent == 1" @click="clickShareholder(6)">
              <img :src="require('@/assets/i/wap/newAreaAgent/areaScore.png')" class="c-ww44 c-hh52"/>
              <span class="c-fs20 c-fc-xblack c-mt8">区代业绩</span>
            </div>
          </div>
        </div>
        <div class="c-mt20 c-flex-row c-justify-sb c-mh24 c-pb40">
          <div class="c-ph30 c-flex-column c-justify-sa c-br20 pbg" @click="spreadAgent()">
            <div class="c-flex-column">
              <span class="c-fs22 c-fc-orange">{{fromType == 'shareholder' ? upAgent.agentName : customName.serviceProviderName}}海报</span>
              <span class="c-fc-orange c-fs18 c-mt10">一键生成推广图<span class="iconfont c-fs24 c-ml4">&#xe986;</span></span>
            </div>
          </div>
          <div class="c-ml20 c-ph30 c-flex-column c-justify-sa c-br20 qybg" @click="goAgentInfo()">
            <div class="c-flex-column">
              <span class="c-fs22 c-fc-orange">{{fromType == 'shareholder' ? upAgent.agentName : customName.serviceProviderName}}权益</span>
              <span class="c-fc-orange c-fs18 c-mt10">了解特权<span class="iconfont c-fs24 c-ml4">&#xe986;</span></span>
            </div>
          </div>
        </div>
        <!-- <div class="c-mh24" v-if="protocolInfoHasAgreed && !fromType">
          <div class="c-fc-smblue c-fs20 c-pb12" @click.stop="clickProtocol(protocolInfoHasAgreed)">
            <span class="c-fs20 c-mr8 iconfont">&#xe6f2;</span>{{protocolInfoHasAgreed.name}}
          </div>
        </div>
        <div class="c-mh24" v-else-if="protocolInfo && !fromType">
          <div class="c-fc-smblue c-fs20 c-pb12" v-for="(item, index) in protocolInfo" :key="index" @click.stop="clickProtocol(item)">
            <span class="c-fs20 c-mr8 iconfont">&#xe6f2;</span>{{item.name}}
          </div>
        </div> -->
      </div>

      <div class="" v-else>
        <header class="agentBg c-w100 c-hh140 c-fs28 c-p">
          <div class="c-pv50 c-fc-white c-textAlign-c">提交审核, 成为{{fromType == 'shareholder' ? agentConf.shareholderName : customName.serviceProviderName}}</div>
          <div class="theme-bg c-fc-white c-fs20 c-ww120 c-hh40 c-flex-row c-flex-center c-br-tl20 c-br-bl20 c-pa c-p-r0 c-p-t20" @click="goAgentInfo()">权益说明</div>
        </header>
        <div class="c-ph24">
          <div class="c-bg-white c-mt10">
            <div class="c-fs24 c-lh34 c-fc-sblack c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
              <div class="c-ws-n">昵称:</div>
              <div class=""><input type="text" readonly v-model="name" placeholder="请输入昵称" class="c-textAlign-r c-fs24 c-bd0 input c-fc-gray" /></div>
            </div>
            <div class="c-fs24 c-lh34 c-fc-sblack c-pv28 c-bd-b1 c-w100 c-flex-row c-aligni-center">
              <div class="c-ws-n c-ww130"><span class="c-fc-xmlred c-pr5">*</span>真实姓名</div>
              <div class="c-flex-row c-justify-end c-flex-1"><input type="text" maxlength="10" v-model="realName" placeholder="请输入真实姓名" class="c-textAlign-r c-fs24 c-bd0 input c-w80" :class="realName == '' ? 'c-fc-gray' : 'c-fc-xblack'" /></div>
            </div>
            <div class="c-fs24 c-lh34 c-fc-sblack c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
              <div class="c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>手机号</div>
              <div class=""><input type="text" v-model="mobile" placeholder="请输入手机号" class="c-textAlign-r c-fs24 c-bd0 input" :class="mobile == '' ? 'c-fc-gray' : 'c-fc-xblack'" /></div>
            </div>
            <div class="c-fs24 c-lh34 c-fc-xblack c-pv12 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center"
              v-if="(agentConf.enableEditMobile ==1 && isShowCode == '') || (agentConf.enableEditMobile ==1 && isShowCode != mobile)">
              <div class="c-ww140 c-ws-n c-hh34 c-flex-shrink0"><span class="c-fc-xmlred c-pr5">*</span>图片验证码</div>
              <input type="text" v-model="imgCode" maxlength="4" placeholder="请输入图片验证码" class="c-textAlign-r c-fs24 c-bd0 input c-hh34 c-ww220 c-ws-n" :class="imgCode == '' ? 'c-fc-sgray' : 'c-fc-xblack'" />
              <div class="c-ww166 c-hh64 c-flex-shrink0">
                <img :src="$addXossFilter(codeImgInfo.img)" alt="" class="c-w100 c-h" @click="getImgCode">
              </div>
            </div>
            <div class="c-fs24 c-lh34 c-fc-xblack c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center"
              v-if="(agentConf.enableEditMobile ==1 && isShowCode == '') || (agentConf.enableEditMobile ==1 && isShowCode != mobile)">
              <div class="c-ww120 c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>验证码</div>
              <input type="text" v-model="code" @input="code=code.slice(0, 4)" maxlength="4" placeholder="请输入短信验证码" class="c-textAlign-r c-fs24 c-bd0 input c-ww300" :class="code == '' ? 'c-fc-sgray' : 'c-fc-xblack'" />
              <div class="fc-f6 c-ph20">|</div>
              <div class="c-ws-n" @click="getYzcode" :class="yzText == '获取验证码' ? 'theme-fc c-ww120' : 'c-fc-gray c-ww180'">{{yzText}}</div>
            </div>
          </div>
        </div>
        <div class="c-hh12 c-bg-sgray"></div>
        <div class="c-ph24">
          <div class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>所在地</div>
            <div class="c-flex-row result" v-if="addressData">
              <x-address :themeColor="$getThemeColor()" title="" v-model="addrValue" :list="addressData" placeholder="请选择地址" :show.sync="showAddress" class="input" :class="addrValue.length == 0 ? 'c-fc-gray' : 'fc-xblack'">
              </x-address><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
            </div>
          </div>
          <div v-if="hideHead == 'false' && fromType == 'shareholder'" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>{{agentConf.shareholderName}}身份</div>
            <div class="c-flex-row result" v-if="arrAgentName.length > 0">
              <popup-picker :themeColor="$getThemeColor()" class="selectPicker" :class="sfValue.length == 0 ? 'c-fc-gray' : 'fc-xblack'" title=""
                :data="getSfListLevel()"
                v-model="sfValue" :placeholder="'请选择身份'"></popup-picker><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
            </div>
          </div>
          <div v-if="hideHead == 'false' && !hasSubType && fromType == ''" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>{{customName.serviceProviderName}}身份</div>
            <div class="c-flex-row result">
              <popup-picker :themeColor="$getThemeColor()" class="selectPicker" :class="sfValue.length == 0 ? 'c-fc-gray' : 'fc-xblack'" title=""
                :data="getSfListLevel()"
                v-model="sfValue" :placeholder="'请选择身份'"></popup-picker><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
            </div>
          </div>
          <div v-if="hasSubType && fromType != 'shareholder'" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>身份选择</div>
            <div class="c-flex-row result">
              <popup-picker :themeColor="$getThemeColor()" class="selectPicker" :class="subType.length == 0 ? 'c-fc-gray' : 'fc-xblack'" title="" :columns="1" :data="subTypeArr" v-model="subType" :placeholder="'请选择身份'" show-name>
              </popup-picker><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
            </div>
          </div>
          <div v-if="fromType == ''" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n">有效期</div>
            <div class="c-fc-xblack">{{agentConf.validPeriod > 0 ? (agentConf.validPeriod + '年') : '永久有效'}}</div>
          </div>
          <div v-if="hideHead == 'false'" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>升级方式</div>
            <div class="c-flex-row result">
              <div v-if="isShowBtn">{{payMethod[0] || '线下付费'}}</div>
              <popup-picker :themeColor="$getThemeColor()" class="selectPicker" v-else :class="payMethod.length == 0 ? 'c-fc-gray' : 'fc-xblack'" @on-hide="onHide" title="" :data="payMethodList" v-model="payMethod"
                placeholder="请选择升级方式"></popup-picker><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
            </div>
          </div>
          <div v-if="payMethod=='线上付费'" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5">*</span>升级费用</div>
            <div class="c-fc-xblack" v-if="agentPrice!=''"><span class="c-fs20">{{'￥' | iosPriceFilter('Agent')}}</span>{{agentPrice}}</div>
          </div>
          <div v-if="fromType == 'shareholder'" class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center">
            <div class="c-ws-n">推荐人</div>
            <div v-if="rShareholderId && shareholderMobile == ''" class="c-flex-grow1 c-textAlign-r c-pr5">{{rShareholderId ? rSName+'(ID:'+ rShareholderId+')' : '请输入推荐股东的手机号'}}</div>
            <div class="c-flex-row c-justify-end c-flex-1" v-else><input type="text" v-model="shareholderMobile" maxlength="11" placeholder="请输入推荐股东的手机号 " class="c-textAlign-r c-fs24 c-bd0 input c-w80" /></div>
          </div>
          <div v-if="fromType == 'shareholder' && shareholderMobile" class="c-fs24 c-lh34 c-pv28 c-w100">
            <template v-if="rShareholderId">该号码对应的股东是：<span class="c-fc-xmlred">{{rSName}}(ID：{{rShareholderId}})</span>，请确认推荐的股东信息无误再提交</template>
            <template v-else><span class="c-fc-xmlred">该号码暂无对应股东，请输入正确的推荐股东的手机号</span></template>
          </div>
        </div>
        <div class="c-hh12 c-bg-sgray" v-if="formList && formList.length > 0"></div>
        <div v-if="fromType == ''">
          <div v-for="(item, index) in formList" :key="index">
            <div v-if="item.type == 1">
              <div class="c-fs24 c-lh34 c-fc-sblack c-pv28 c-bd-b1 c-w100 c-flex-row c-aligni-center c-ph24">
                <div class="c-ws-n c-ww130"><span class="c-fc-xmlred c-pr5" v-if="item.status">*</span>{{item.title}}</div>
                <div class="c-flex-row c-justify-end c-flex-1"><input type="text" v-model="item.value" :placeholder="`请输入${item.title}`" class="c-textAlign-r c-fs24 c-bd0 input c-w80" :class="item.value == '' ? 'c-fc-gray' : 'c-fc-xblack'" /></div>
              </div>
            </div>
            <div v-else class="c-fs24 c-lh34 c-pv28 c-bd-b1 c-w100 c-flex-row c-justify-sb c-aligni-center c-ph24">
              <div class="c-fc-sblack c-ws-n"><span class="c-fc-xmlred c-pr5" v-if="item.status">*</span>{{item.title}}</div>
              <div class="c-flex-row result">
                <popup-picker :themeColor="$getThemeColor()" class="selectPicker" :data="getSubTitle(item.subTitle)" v-model="item.value" :placeholder="`请选择${item.title}`" @on-change="onChanage(index, item.value)">
                </popup-picker><i class="iconfont c-fs20 c-fc-gray c-pl10">&#xe60e;</i>
              </div>
            </div>
          </div>
        </div>
      </div>
      <footer v-if="!isShowPartner" class="c-box-shadow9 c-flex-row c-ph24 c-aligni-center c-justify-sb c-bd-t1 c-hh88 c-pf c-p-b0 c-w100 c-maxw640 c-bg-white c-pz1">
        <div v-if="!$isWxApp()" @click="spreadAgent" class="c-flex-column c-aligni-center c-pr24 c-justify-sb c-hh64">
          <img src="@/assets/i/wap/course/btn_share.png" class="c-hh32 c-ww30 img-pe-none  invite-animation"/>
          <span class="c-fc-xblack c-fs16">{{fromType == 'shareholder' && upAgent.agentName? upAgent.agentName :  customName.serviceProviderName}}海报</span>
        </div>
        <div class="c-flex-grow1 c-w0 c-flex-row c-flex-center c-hh64 c-fs28 c-fc-white c-br36" :class="(payMethod!='线上付费') && isShowBtn ? 'c-bg-ddd' : 'theme-bg'" @click="submitApply">
          {{(payMethod!='线上付费') && isShowBtn ? "审核中" : applyText}}<span class="c-ml12" v-if="!$isWxAppIos() && isOnLineApply && agentPrice!='' && !((payMethod!='线上付费') && isShowBtn)"><span class="c-fs20">{{'￥' | iosPriceFilter('Agent')}}</span>{{agentPrice}}</span>
        </div>
      </footer>
    </template>
    <my-loading :showLoading="isMyLoadding"></my-loading>
    <div class="c-h c-pf c-p-t0 c-p-l0 c-p-r0 c-m-0auto c-w100 c-maxw640 c-pz10000" v-if="isApplySuccess">
      <div class="masker"></div>
      <div class="content">
        <img :src="$addXossFilter('https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/newAreaAgent/serverApplybg.png')"/>
        <div class="c-pa c-w100 c-flex-column c-aligni-center" style="top:3.2rem;">
          <div class="c-flex-column c-aligni-center c-w100">
            <span class="c-fs44 c-fc-reword">恭喜</span>
            <span class="c-fs26 c-fc-xblack c-mt20">成功升级为{{fromType == 'shareholder' ? memberInfo.sName : sfValue[0]}}</span>
          </div>
          <div class="c-w70 c-mt120 c-p" @click="isApplySuccess = false;">
            <img :src="require('@/assets/i/wap/payPolitely/giftDialog_btn.png')" class="c-w100"/>
            <div class="c-pa c-p-t0 c-p-l0 c-fc-xxmred c-flex-row c-flex-center c-fs24 c-w100 c-h">我知道了</div>
          </div>
        </div>
      </div>
    </div>
    <cj-popup v-model="isShowRenew" round closeable title="续期">
      <div class="c-ww570 c-bg-white c-fs24 c-p c-pb40 c-br20">
        <div class="c-flex-column c-pl40 c-pt20">
          <div class="c-flex-row c-aligni-center"><span class="c-fc-sblack">续期身份：</span><span>{{custNameMap[memberInfo.vipType]}}</span></div>
          <div class="c-mt10 c-flex-row c-aligni-center c-mt30"><span class="c-fc-sblack">续期时长：</span><span>{{agentConf.validPeriod > 0 ? (agentConf.validPeriod + '年') : '永久有效'}}</span></div>
        </div>
        <div class="c-flex-row c-aligni-center c-mt30 c-pl40" v-if="payMethodList[0].length == 0"><span class="c-fc-sblack">您的续费方式为：</span><span>{{payMethod[0]}}</span></div>
        <div class="c-flex-row c-mt30 c-pl40" v-else>
          <span class="c-fc-sblack">续期方式：</span>
          <div class="c-flex-column c-aligni-center">
            <div class="c-flex-row c-aligni-center" :class="index != 0 ? 'c-mt20' : ''" v-for="(item ,index) in payMethodList[0]" v-if="item != '免费升级'" :key="index" @click="payMethod = item;"><i class="iconfont c-fs36" :class="payMethod && payMethod == item ? 'theme-fc' : 'c-fc-gray'">{{payMethod == item ? '&#xe6eb;' : '&#xe797;'}}</i><span class="c-fs24 c-ml10">{{item}}</span></div>
          </div>
        </div>
        <div class="c-flex-row c-justify-sa c-mt40" @click="onConfirmRenew"><span class="theme-bg c-fc-white c-fs22 c-lh22 c-ph80 c-pv24 c-br32">确定</span></div>
      </div>
    </cj-popup>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
import { XAddress, PopupPicker } from 'ckjrweb-mp-ui/src/components/index';
import identityCom from "@/components/templates/common/identityCom.vue";
import myLoading from "@/plugin/loading/loading.vue";
let isLoadding = false;
export default {
  name: "AgentIndex",
  components: {
    XAddress,
    PopupPicker,
    myLoading,
    identityCom
  },
  data() {
    return {
      hideHead: localStorage.getItem('hideHead') || 'false',
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      memberInfo: "", // 登录会员信息
      addrValue: [],
      showAddress: false,
      addressData: '', // addressData,
      name: "", // 姓名
      mobile: "", // 手机号
      realName: "", //真实姓名
      sfValue: [], // 身份类型
      sfListLevel: [[]], //服务商等级
      partnerData: "",
      isShowBtn: false, // 是否显示审核中按钮
      isShowFail: false, // 是否显示审核失败
      isShowPartner: true, // 是否显示服务商信息
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      payMethodList: [["线上付费", "线下付费", "免费升级"]],
      payMethod: [],
      agentConf: '',
      agentPrice: '',
      applyStatus: -1,
      aaId: '',
      isCancle: 0,
      // 自定义服务商名称
      customName: JSON.parse(localStorage.getItem("customName")),
      slectProvince: {},
      isPhone: false, // 是否已绑定手机号
      enableBindPhoneInAll: 0, // 是否设置绑定手机
      ckFrom: global.ckFrom,
      showSpreadAgent: true,
      memberId: '',
      subTypeArr: [],
      subType: [],
      hasSubType: false, //是否有服务商拓展名称
      isShare: false, //判断是否通过分享链接过来的
      codeImgInfo: {},
      isLoading: false,
      num: 60,
      yzText: "获取验证码",
      imgCode: '',
      code: '',
      isYz: true,
      isShowCode: "",
      upAgent: null,
      otherJoinType: 0, //0:申请服务商, 1:其他加入方式
      isMyLoadding: false,
      isApplySuccess: false, //申请成功样式提醒
      custNameMap: [],
      showAllContent: false, //招募信息是否全部展示
      fromType: '', //shareholder是指进入股东中心,空就是服务商的
      arrAgentName: [], //后台返回的服务商或者股东级别名称
      formList: [], //服务商接收自定义字段
      formArr: [], //服务商自定义字段传后端
      isMustInfo: false,
      agent: '',
      isCardInfo: false, //是否有选证件类型
      rShareholderId: '', //推荐股东
      rSName: '', //推荐股东名称（有真名就取真名，没有就取昵称）
      shareholderMobile: '', //输入上级股东手机号
      protocolInfo: null, // 协议信息
      isCheckAgreement: false, // 是否勾选协议
      agentApplyConf: null,
      isShowRenew: false,
      protocolInfoHasAgreed: null,
      isDying: false,
      isPromotion: 0, // 是否是推广视频号
      isHiddenAgent: true,
    };
  },
  created() {
    utilJs.appShare(this);
  },
  computed: {
    isOnLineApply() { // 是否是线上申请
      return this.payMethod == '线上付费'
    },
    applyText() { // 申请的文字显示
      if ((this.payMethod != '线上付费') && !this.isShowBtn && !this.isShowFail) {
        return '提交审核'
      } else if ((this.payMethod != '线上付费') && this.isShowFail) {
        return '审核失败，请重新提交'
      } else {
        return this.$isWxAppIos() ? '咨询客服' : '立即升级'
      }
    },
  },
  watch: {
    shareholderMobile(val) {
      this.getRSholderId(val, '');
    },
    mobile() {
      if (this.mobile && isNaN(this.mobile)) {
        this.mobile = "";
      } else if (this.mobile) {
        this.mobile.length > 11 && this.mobile.substr(0, 11);
      }
    },
    sfValue() {
      if (this.fromType == "shareholder" && this.arrAgentName.length > 0) {
        if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[0].name) {
          this.agentPrice = this.arrAgentName[0].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[1].name) {
          this.agentPrice = this.arrAgentName[1].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[2].name) {
          this.agentPrice = this.arrAgentName[2].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[3].name) {
          this.agentPrice = this.arrAgentName[3].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[4].name) {
          this.agentPrice = this.arrAgentName[4].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[5].name) {
          this.agentPrice = this.arrAgentName[5].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[6].name) {
          this.agentPrice = this.arrAgentName[6].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[7].name) {
          this.agentPrice = this.arrAgentName[7].cost;
        } else if (this.arrAgentName && this.sfValue[0] == this.arrAgentName[8].name) {
          this.agentPrice = this.arrAgentName[8].cost;
        }
      } else {
        if (this.agentConf && this.sfValue[0] == this.customName.agentName) {
          this.agentPrice = this.agentConf.agentCost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.partnerName) {
          this.agentPrice = this.agentConf.partnerCost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.branchName) {
          this.agentPrice = this.agentConf.branchCost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.cooName) {
          this.agentPrice = this.agentConf.cooCost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.agencyName) {
          this.agentPrice = this.agentConf.agencyCost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.agent6Name) {
          this.agentPrice = this.agentConf.agent6Cost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.agent7Name) {
          this.agentPrice = this.agentConf.agent7Cost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.agent8Name) {
          this.agentPrice = this.agentConf.agent8Cost;
        } else if (this.agentConf && this.sfValue[0] == this.customName.agent9Name) {
          this.agentPrice = this.agentConf.agent9Cost;
        }
      }
    }
  },
  methods: {
    copyText(id) {
      utilJs.copyText(id);
    },
    goWxecshopList() {
      this.$routerGo(this, "push", { path: "/homePage/wxecshop/wxecshopList" });
    },
    goIncome() {
      this.$routerGo(this, "push", { path: "/member/classmates/promoteIncomeList" });
    },
    goRelatedIncomeProds() {
      this.$routerGo(this, "push", { path: "/member/classmates/relatedIncomeProds" });
    },
    //服务商设置续期  这个是已经是服务商的前提下
    onConfirmRenew() {
      if (!this.payMethod || this.payMethod.length == 0) {
        this.$showCjToast({
          text: '请先选择续期方式!',
          type: 'warn'
        });
        return;
      }
      this.isShowRenew = false;
      if (this.payMethod && this.payMethod == '线下付费') {
        // 线下付期
        utilJs.postMethod(global.apiurl + 'Agent/agentOfflineRenew', {}, (res) => {
          this.$showCjToast({
            text: "续费申请已提交，请联系商家进行缴费",
            type: "success"
          });
        }, failres => {});
      } else {
        // 线上付费
        let applyType = this.memberInfo.vipType;
        this.$routerGo(this, "push", {
          path: '/homePage/course/coursePay',
          query: { cId: -1, extId: applyType, ckFrom: global.ckFrom.agentRenew, isFromInvite: 0, aaId: '', protocolId: '' }
        });
      }
    },
    getRSholderId(val, rsId) { //获取推荐人股东id跟名称
      if ((val && utilJs.isPhoneNumber(val)) || rsId) {
        utilJs.getMethod(`${global.apiurl}shareholder/checkShareholder?mobile=${this.shareholderMobile}&rShareholderId=${rsId}`, res => {
          this.rShareholderId = res.rShareholderId;
          this.rSName = res.rRealName;
        }, failRes => {
        });
      } else {
        this.rShareholderId = '';
        this.rSName = '';
      }
    },
    getSubTitle(subTitle) {
      if (!subTitle) {
        return;
      }
      let list = [];
      list[0] = [];
      for (let index in subTitle) {
        list[0].push(subTitle[index].title);
      }
      return list;
    },
    //点击显示更多
    clickShowMore() {
      this.showAllContent = !this.showAllContent;
    },
    //服务上等级名称
    getSfListLevel() {
      if (this.fromType == "shareholder" && this.arrAgentName.length > 0) {
        let nameAttr = [[this.arrAgentName[0].name]];
        if (this.arrAgentName.length > 1) {
          for (let i = 1; i < this.arrAgentName.length; i++) {
            nameAttr[0].push(this.arrAgentName[i].name);
          }
        }
        return nameAttr;
      } else {
        let nameAttr = [[JSON.parse(localStorage.getItem("customName")).agentName]];
        if (this.otherJoinType == 0 && this.upAgent && this.upAgent.isOpenJoinAgent == 1) {
          return nameAttr;
        } else if (this.otherJoinType == 0 && this.upAgent && this.upAgent.isOpenJoinAgent == 2 && this.arrAgentName.length > 0) {
          let arr = this.arrAgentName.map((item) => {
            return item.name
          })
          return [arr];
        } else {
          if (this.companyAuth.agentLevels >= 2) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).partnerName);
          }
          if (this.companyAuth.agentLevels >= 3) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).branchName);
          }
          if (this.companyAuth.agentLevels >= 4) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).cooName);
          }
          if (this.companyAuth.agentLevels >= 5) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).agencyName);
          }
          if (this.companyAuth.agentLevels >= 6) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).agent6Name);
          }
          if (this.companyAuth.agentLevels >= 7) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).agent7Name);
          }
          if (this.companyAuth.agentLevels >= 8) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).agent8Name);
          }
          if (this.companyAuth.agentLevels >= 9) {
            nameAttr[0].push(JSON.parse(localStorage.getItem("customName")).agent9Name);
          }
          return nameAttr;
        }
      }
    },
    getArrSubTypeName() {
      if (this.fromType == "shareholder") {
        return;
      }
      utilJs.getMethod(`${global.apiurl}members/getArrSubTypeName`, res => {
        this.subTypeArr = res.data;
        if (this.subTypeArr && this.subTypeArr.length > 0) {
          this.hasSubType = true;
          this.subTypeArr.forEach(function (item) {
            item.value = "" + item.subType;
          })
        }
      }, failRes => {
      });
    },
    spreadAgent: function () {
      let q = this.fromType == "shareholder" ? 2 : 1;
      this.$routerGo(this, "push", {
        path: `/homePage/spread/spreadAgent?&ckFrom=${q}`,
      });
    },
    submitApply() {
      this.isMustInfo = false;
      this.isCardInfo == false;
      if (this.payMethod != '线上付费' && this.isShowBtn) {
        this.checking();
        return;
      }
      if (this.hideHead == 'true' && this.fromType == '') { //服务商的业务
        this.payMethod = '线下付费';
        this.sfValue = [this.customName.agentName];
      }
      if (!this.name) {
        this.$showCjToast({
          text: "请输入姓名",
          type: "warn",
        });
        return;
      } else if (!this.realName || this.realName.length < 1) {
        this.$showCjToast({
          text: "请输入真实姓名",
          type: "warn",
        });
        return;
      } else if (!this.mobile || this.mobile.length == 0) {
        this.$showCjToast({
          text: "请填写手机号",
          type: "warn",
        });
        return;
      } else if (this.mobile.length < 7 || this.mobile.length > 11) {
        this.$showCjToast({
          text: "请填写正确手机号",
          type: "warn",
        });
        return;
      } else if (((this.agentConf.enableEditMobile == 1 && this.isShowCode == '') || (this.agentConf.enableEditMobile == 1 && this.isShowCode != this.mobile)) && this.imgCode.length < 4) {
        this.$showCjToast({
          text: "请输入图片验证码",
          type: "warn",
        });
        return;
      } else if (((this.agentConf.enableEditMobile == 1 && this.isShowCode == '') || (this.agentConf.enableEditMobile == 1 && this.isShowCode != this.mobile)) && this.code.length < 4) {
        this.$showCjToast({
          text: "请输入验证码",
          type: "warn",
        });
        return;
      } else if (this.addrValue.length <= 0) {
        this.$showCjToast({
          text: "请选择所在地",
          type: "warn",
        });
        return;
      } else if (this.sfValue.length <= 0 && !this.hasSubType) {
        this.$showCjToast({
          text: this.fromType == 'shareholder' ? '请选择身份' : "请选择代理身份",
          type: "warn",
        });
        return;
      } else if (this.subType.length <= 0 && this.hasSubType) {
        this.$showCjToast({
          text: "请选择身份",
          type: "warn",
        });
        return;
      } else if (this.payMethod.length <= 0) {
        this.$showCjToast({
          text: "请选择升级方式",
          type: "warn",
        });
        return;
      } else if (this.fromType == 'shareholder' && this.shareholderMobile.length > 0 && !this.rShareholderId) {
        this.$showCjToast({
          text: "请填入正确推荐股东手机号",
          type: "warn",
        });
        return
      }
      if (this.fromType == "" && this.formList.length > 0) {
        this.formList.forEach((item, index) => {
          if (item.default == 2 && item.status == false && item.value != '') {
            this.isCardInfo = true;
          }
          if (this.isCardInfo == true && item.default == 1 && item.value == '') {
            this.$showCjToast({
              text: "请填写证件号码",
              type: "warn",
            });
            this.isMustInfo = true;
            return;
          }
          if (this.isMustInfo == true) {
            return;
          }
          if (item.status == true && !item.value) {
            this.$showCjToast({
              text: "请填写信息",
              type: "warn",
            });
            this.isMustInfo = true;
            return;
          } else {
            // type: 1 文本框, 2 下拉选项
            if ((item.type == 1 && item.status == true) || (item.type == 1 && item.status == false && !!item.value)) {
              this.formArr.push({id: item.id, content:item.value, default: item.default})
            } else if ((item.type == 2 && item.status == true) || (item.type == 2 && item.status == false && !!item.value)) {
              this.formArr.push({id: item.id, content: item.value[0], default: item.default})
            }
          }
        })
        if (this.isMustInfo == true) {
          this.formArr = [];
          return;
        }
      }
      let applyType = 3;
      if (this.fromType == 'shareholder') {
        if (this.sfValue && this.sfValue[0] == this.arrAgentName[0].name) {
          applyType = this.arrAgentName[0].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[1].name) {
          applyType = this.arrAgentName[1].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[2].name) {
          applyType = this.arrAgentName[2].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[3].name) {
          applyType = this.arrAgentName[3].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[4].name) {
          applyType = this.arrAgentName[4].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[5].name) {
          applyType = this.arrAgentName[5].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[6].name) {
          applyType = this.arrAgentName[6].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[7].name) {
          applyType = this.arrAgentName[7].type;
        } else if (this.sfValue && this.sfValue[0] == this.arrAgentName[8].name) {
          applyType = this.arrAgentName[8].type;
        }
      } else {
        applyType = 3;
        if (this.sfValue && this.sfValue[0] == this.customName.agentName) {
          applyType = 3
        } else if (this.sfValue && this.sfValue[0] == this.customName.partnerName) {
          applyType = 5
        } else if (this.sfValue && this.sfValue[0] == this.customName.branchName) {
          applyType = 6
        } else if (this.sfValue && this.sfValue[0] == this.customName.cooName) {
          applyType = 7
        } else if (this.sfValue && this.sfValue[0] == this.customName.agencyName) {
          applyType = 8
        } else if (this.sfValue && this.sfValue[0] == this.customName.agent6Name) {
          applyType = 9
        } else if (this.sfValue && this.sfValue[0] == this.customName.agent7Name) {
          applyType = 10
        } else if (this.sfValue && this.sfValue[0] == this.customName.agent8Name) {
          applyType = 11
        } else if (this.sfValue && this.sfValue[0] == this.customName.agent9Name) {
          applyType = 12
        }
        if (this.hasSubType) { //平台版才有服务商拓展名称
          applyType = 3;
        }
      }
      if (isLoadding) {
        return;
      }
      let data = null;
      if (this.aaId && this.isCancle != 1 && this.payMethod == "线上付费") {
        data = {
          applyType: applyType,
          name: this.name,
          mobile: this.mobile,
          realName: this.realName,
          provinceId: this.addrValue[0],
          cityId: this.addrValue[1],
          areaId: this.addrValue[2],
          applyStatus: this.payMethod == "线下付费" ? 1 : this.payMethod == "线上付费" ? 2 : 5,
          aaId: this.aaId,
          code: this.code,
          form: this.fromType == "" && this.formList.length > 0 ? this.formArr : '',
        };
      } else {
        data = {
          applyType: applyType,
          name: this.name,
          mobile: this.mobile,
          realName: this.realName,
          provinceId: this.addrValue[0],
          cityId: this.addrValue[1],
          areaId: this.addrValue[2],
          applyStatus: this.payMethod == "线下付费" ? 1 : this.payMethod == "线上付费" ? 2 : 5,
          code: this.code,
          form: this.fromType == "" && this.formList.length > 0 ? this.formArr : '',
        };
      }
      if (this.hasSubType && this.fromType == '') {
        data.subType = this.subType[0];
      }
      if (this.fromType == 'shareholder' && this.rShareholderId) {
        data.rShareholderId = this.rShareholderId;
      }
      isLoadding = true;
      let url = this.fromType == 'shareholder' ? 'shareholder/applySave' : 'members/applySave';
      let $this = this;
      utilJs.postMethod(global.apiurl + url, data, function (
        res
      ) {
        if ($this.payMethod == '线上付费') {
          if (!utilJs.isOpenIosGzhPay($this.ckFrom.agentApply)) {
            isLoadding = false;
            $this.$store.commit('updateShowVitualModal', true);
            return;
          }
          $this.aaId = res.aaId;
          let cf = $this.fromType == 'shareholder' ? global.ckFrom.shareholder : (applyType == 3 ? global.ckFrom.agentApply : applyType == 5 ? global.ckFrom.partnerApply : applyType == 6 ? global.ckFrom.branchApply : applyType == 7 ? global.ckFrom.cooApply : applyType == 8 ? global.ckFrom.agencyApply : applyType == 9 ? global.ckFrom.agent6Apply : applyType == 10 ? global.ckFrom.agent7Apply : applyType == 11 ? global.ckFrom.agent8Apply : global.ckFrom.agent9Apply);
          if ($this.fromType == 'shareholder') {
            applyType = res.id;
          }
          $this.$routerGo($this, "push", {
            path: '/homePage/course/coursePay',
            query: { cId: -1, extId: applyType, ckFrom: cf, isFromInvite: 0, aaId: $this.aaId, protocolId: data.protocolId }
          });
        } else {
          if (res.status == 1) {
            $this.getApplyPage(1);
            $this.isApplySuccess = true;
            $this.isShowPartner = true;
          } else {
            $this.checking();
          }
          $this.isShowBtn = true;
          $this.isShowFail = false;
          isLoadding = false;
        }
      }, failres => {
        isLoadding = false;
      });
    },
    checking() {
      this.$showCjToast({
        text: "您已申请，请耐心等待审核",
        type: "warn",
      });
    },
    getApplyPage(type) {
      let $this = this;
      let url = this.fromType == "shareholder" ? 'shareholder/shareholderApplyPage' : 'members/agentApplyPage';
      utilJs.getMethod(global.apiurl + url, function (res) {
        $this.isMyLoadding = false;
        $this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
        $this.enableBindPhoneInAll = res.enableBindPhoneInAll;
        // 自定义服务商名称
        $this.customName = JSON.parse(localStorage.getItem("customName"));
        //张法老师定制，隐藏选择服务商类型和升级方式；
        $this.hideHead = localStorage.getItem('hideHead') || 'false';
        $this.agentConf = res.agentConf;
        $this.agentApplyConf = res.agentApplyConf;
        // $this.protocolInfoHasAgreed = res.protocol;
        if ($this.agentConf.expire) { //到期时间小于7天才展示立即续期
          let nowTimeSt = new Date().getTime();
          let expTimest = new Date($this.agentConf.expire.replace(/-/g, "/")).getTime();
          if ((expTimest - nowTimeSt) < 7 * 24 * 60 * 60 * 1000) {
            $this.isDying = true;
          }
        }
        if (res.agentConf.enableEditMobile && res.agentConf.enableEditMobile == 1) {
          $this.getImgCode();
        }
        if ($this.fromType == "shareholder") {
          $this.rShareholderId = res.rShareholderId;
          $this.rSName = res.rSName;
          if (!res.rShareholderId && $this.fromType == "shareholder" && $this.$route.query.shareholderId) {
            $this.getRSholderId('', $this.$route.query.shareholderId);
          }
        }
        $this.isPromotion = res.isPromotion;
        $this.memberInfo = res.userInfo;
        $this.name = res.userInfo.nickname;
        $this.mobile = res.userInfo.mobile;
        $this.isShowCode = res.userInfo.mobile;
        $this.isPhone = res.userInfo.mobile != null && res.userInfo.mobile != '' ? true : false;
        $this.realName = res.userInfo.realName;
        if (res.userInfo.vipType == 3 || res.userInfo.vipType >= 5) {
          localStorage.setItem("vipType" + localStorage.getItem("userId"), res.userInfo.vipType);
        }
        // if (type == 1) {
          $this.formList = $this.fromType == "shareholder" ? '' : res.form;
        // }
        if (res.userInfo.provinceId && res.userInfo.cityId && res.userInfo.areaId) {
          $this.addrValue = [
            "" + res.userInfo.provinceId,
            "" + res.userInfo.cityId,
            "" + res.userInfo.areaId
          ];
        }
        if ($this.agentConf && $this.agentConf.status == 1) {
          $this.payMethodList = [["线下付费"]];
          $this.payMethod = ["线下付费"];
        } else if ($this.agentConf && $this.agentConf.status == 2) {
          $this.payMethodList = [["线上付费"]];
          $this.payMethod = ["线上付费"];
        } else if ($this.agentConf && $this.agentConf.status == 3) { //agentConf.status:-1关闭，1下，2上，3上下， 4免， 5免下,6免上,7全部
          $this.payMethodList = [["线上付费", "线下付费"]];
        } else if ($this.agentConf && $this.agentConf.status == 4) {
          $this.payMethodList = [["免费升级"]];
          $this.payMethod = ["免费升级"];
        } else if ($this.agentConf && $this.agentConf.status == 5) {
          $this.payMethodList = [["线下付费", "免费升级"]];
        } else if ($this.agentConf && $this.agentConf.status == 6) { //agentConf.status:-1关闭，1下，2上，3上下， 4免， 5免下,6免上,7全部
          $this.payMethodList = [["线上付费", "免费升级"]];
        } else {
          $this.payMethodList = [["线上付费", "线下付费", "免费升级"]];
        }
        $this.arrAgentName = res.arrAgentName;
        //服务商
        if ($this.agentConf && $this.subTypeArr && $this.subTypeArr.length > 0) {
          $this.sfValue = [$this.customName.agentName];
        }
        if (res.agent != null) {
          // 申请表中有数据
          $this.isCancle = res.agent.isCancel;
          $this.agent = res.agent;
          if ([2, 4, 5].includes(res.agent.auditStatus) || (res.agent.auditStatus == 3 && res.agent.isCancel != 1)) {
            // 审核通过
            if ($this.fromType == '' &&
              (res.userInfo.vipType == 1 ||
              res.userInfo.vipType == 2 ||
              res.userInfo.vipType == 4)
            ) {
              $this.isShowPartner = false;
              $this.isShowFail = false;
              $this.isShowBtn = false;
              $this.mobile = "";
              $this.realName = "";
              $this.sfValue = [];
              $this.payMethod = [];
              return false;
            } else {
              $this.partnerData = res.agent;
              $this.partnerData.sStatus = res.userInfo.sStatus;
              $this.isShowPartner = true;
              $this.isShowFail = false;
              $this.isShowBtn = false;
              if ($this.fromType == 'shareholder' && res.userInfo.sStatus == 1) { //如果是股东身份，那么股东分享要带自己的id
                window.localStorage.setItem("shareholderId", localStorage.getItem("userId"));
              }
            }
          } else {
            $this.isShowPartner = false;
            $this.aaId = res.agent.aaId;
            if (res.agent.auditStatus == 1 || res.agent.auditStatus == -3) {
              // 审核中
              if (res.agent.auditStatus == -3) {
                $this.isShowBtn = false;
              } else {
                $this.isShowBtn = true;
              }
              $this.isShowFail = false;
              $this.name = res.agent.nickname;
              $this.mobile = res.agent.mobile;
              $this.realName = res.agent.realName;
              $this.payMethod = res.agent.auditStatus == -3 ? ["线上付费"] : res.agent.applyStatus == 5 ? ["免费升级"] : ["线下付费"];
              if ($this.fromType == "") { //服务商
                if (res.agent.vipType == 3) {
                  $this.sfValue = [$this.customName.agentName]
                  if ($this.agentConf && $this.subTypeArr && $this.subTypeArr.length > 0 && res.agent.subType != null) {
                    let fArr = $this.subTypeArr.filter(aItem => {
                      return aItem.subType == res.agent.subType;
                    })
                    if (fArr.length > 0) {
                      $this.subType = [fArr[0].subType.toString()];
                    }
                  }
                } else if (res.agent.vipType >= 5) {
                  $this.sfValue = [$this.custNameMap[res.agent.vipType]];
                }
              } else if ($this.fromType == "shareholder") {
                $this.sfValue = [res.arrAgentName[res.agent.type - 1].name];
              }
              if (
                res.agent.provinceId != null &&
                res.agent.cityId != null &&
                res.agent.areaId != null
              ) {
                $this.addrValue = [
                  "" + res.agent.provinceId,
                  "" + res.agent.cityId,
                  "" + res.agent.areaId
                ];
              }
            } else if (res.agent.auditStatus == -1) {
              // 审核失败
              $this.isShowFail = true;
              $this.isShowBtn = false;
              if ($this.fromType == 'shareholder') {
                $this.sfValue = [res.arrAgentName[0].name];
              }
            } else {
              $this.isShowFail = false;
              $this.isShowBtn = false;
              if ($this.fromType == 'shareholder') {
                $this.sfValue = [res.arrAgentName[0].name];
              }
            }
          }
        } else {
          // 用户表身份 没经过申请表
          $this.partnerData = res.userInfo;
          if (($this.fromType == '' && ($this.partnerData.vipType == 3 || $this.partnerData.vipType >= 5)) || ($this.fromType == 'shareholder' && $this.partnerData.type > 0)
          ) {
            $this.isShowPartner = true;
            $this.isShowFail = false;
            if ($this.fromType == 'shareholder' && res.userInfo.sStatus == 1) {
              window.localStorage.setItem("shareholderId", localStorage.getItem("userId"));
            }
          } else {
            $this.isShowPartner = false;
            $this.isShowFail = false;
          }
          if ($this.fromType == 'shareholder') {
            $this.sfValue = [res.arrAgentName[0].name];
          }
        }
        if ($this.fromType == "" && res.form.length > 0 && type == 1) {
          res.form.forEach((item, index) => {
            if (item.type == 2) {
              if (!!item.content) {
                $this.formList[index].value = [item.content];
              } else {
                $this.formList[index].value = [];
              }
            } else {
              if (!!item.content) {
                $this.formList[index].value = item.content;
              } else {
                $this.formList[index].value = "";
              }
            }
          })
        }
        if ($this.upAgent && Number($this.upAgent.isOpenJoinAgent) >= 1 && $this.fromType == '' && (res.userInfo.vipType < 3 || res.userInfo.vipType == 4)) { //单独开启指定商品 || 任意级别门槛才能申请服务商的付费模式
          if ($this.upAgent.isOpenJoinAgent == 1 || ($this.upAgent.isOpenJoinAgent == 2 && $this.otherJoinType == 1)) {
            $this.sfValue = [$this.customName.agentName];
          }
          if ($this.otherJoinType > 0) {
            $this.payMethodList = [["线上付费"]];
            $this.payMethod = ["线上付费"];
          } else {
            if ($this.agentConf && ($this.agentConf.status == 3 || $this.agentConf.status > 5)) {
              $this.payMethodList = $this.agentConf.status == 3 ? [["线下付费"]] : $this.agentConf.status == 6 ? [["免费升级"]] : [["线下付费", "免费升级"]];
              $this.payMethod = $this.agentConf.status == 3 ? ["线下付费"] : [];
            }
          }
        }
        $this.$forceUpdate();
      });
    },
    onChanage(i, value) {
      if (this.agent.auditStatus == -3 && value && value[0]) {
        this.formList[i].value = [value[0]];
      }
      this.$forceUpdate()
    },
    clickItem(listType) {
      if (listType == 6) {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/myTeamPerformance",
        });
      } else if (listType == 7) {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/agentInfo",
          query: { index: -1 }
        });
      } else if (listType == 8) {
        this.$routerGo(this, "push", {
          path: "/homePage/spread/SpreadMoney",
        });
      } else if (listType == 9) {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/conditionForPromotion"
        });
      } else if (listType == 10) {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/myTeamList"
        });
      } else if (listType == 'amount') {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/staffIndex",
          query: { type: 1 }
        });
      } else {
        if (listType == 1 && this.fromType == "shareholder") {
          this.clickShareholder(4);
        } else {
          this.$routerGo(this, "push", {
            path: "/homePage/agent/agentDetail",
            query: { listType: listType }
          });
        }
      }
    },
    clickShareholder(listType) {
      if (listType == 5) {
        this.$routerGo(this, "push", {
          path: "/homePage/agent/agentInfo",
          query: { index: -2, fromType: 'shareholder' }
        });
      } else {
        this.$routerGo(this, "push", {
          path: "/homePage/shareholder/shareholderDetail",
          query: { listType: listType }
        });
      }
    },
    goWithdraw() {
      this.$routerGo(this, "push", {
        path: "/member/scholarship/withdraw?from=shareholder"
      });
    },
    getImgCode() {
      if (this.isLoading == true) {
        return;
      }
      this.isLoading = true;
      utilJs.getMethod(`${global.apiurl}common/captcha`, res => {
        this.codeImgInfo = res;
        this.isLoading = false;
      }, failRes => {
        this.isLoading = false;
      });
    },
    changeOpenAgent() {
      if (this.protocolInfo && this.isCheckAgreement == false) {
        this.$showCjToast({
          text: '请勾选协议',
          type: 'warn'
        });
        return;
      }
      if (this.fromType == 'areaAgent') {
        this.$routerGo(this, "push", {
          path: "/homePage/newAreaUser/apply",
          query: { comeFrom: 2, isFromAgent: 1 }
        });
      } else {
        this.upAgent.isOpenJoinAgent = 0;
      }
    },
    getYzMethod: function () {
      this.isYz = false;
      this.num -= 1;
      this.yzText = this.num + "秒后重新获取";
      if (this.num == 0) {
        clearInterval(this.interval);
        this.yzText = "获取验证码";
        this.isYz = true;
        this.num = 60;
        this.isClick = false;
      }
    },
    getYzcode: function () {
      if (!this.isClick) {
        this.isClick = true;
        if (!!this.mobile) {
          if (this.imgCode == '') {
            this.$showCjToast({
              text: "图片验证码不能为空",
              type: "warn",
            });
            this.isClick = false;
          } else {
            let $this = this;
            $this.yzText = "发送中";
            utilJs.postMethod(global.apiurl + "members/sendCode", {
              mobile: this.mobile,
              captcha: this.imgCode,
              captchaKey: this.codeImgInfo.key,
            }, res => {
              if (res.errMsg) {
                $this.yzText = "获取验证码";
                $this.isClick = false;
                $this.$showCjToast({
                  text: res.errMsg,
                  type: "warn",
                });
              } else {
                $this.interval = setInterval($this.getYzMethod, 1000);
              }
            }, function () {
              clearInterval($this.interval);
              $this.yzText = "获取验证码";
              $this.isYz = true;
              $this.num = 60;
              $this.isClick = false;
            })
          }
        } else {
          this.$showCjToast({
            text: "手机号不能为空",
            type: "warn",
          });
          this.isClick = false;
        }
      }
    },
    clickProtocol(item) {
      this.$routerGo(this, "push", { path: `/homePage/agent/protocolInfo`, query: { protocolId: item.protocolId } });
    },
    //分享
    wechatShare: function () {
      let title = this.isShowPartner ? `升级${this.fromType == 'shareholder' ? this.upAgent.agentName : this.customName.serviceProviderName}` : (this.upAgent ? this.upAgent.recruitName : `升级${this.fromType == 'shareholder' ? this.upAgent.agentName : this.customName.serviceProviderName}`);
      let shareImg = 'https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/common/provider.png';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}&fromType=${this.fromType}`;
      if (this.fromType == 'shareholder' && localStorage.getItem("shareholderId")) {
        shareUrl += "&shareholderId=" + localStorage.getItem("shareholderId");
      }
      let shareDesc = this.isShowPartner ? "点击查看详情" : (this.upAgent.recruitShareDesc || "点击查看详情");
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc, function () { }, true);
    },
    //手机端分享
    appShare: function () {
      let title = this.isShowPartner ? `升级${this.fromType == 'shareholder' ? this.upAgent.agentName : this.customName.serviceProviderName}` : (this.upAgent ? this.upAgent.recruitName : `升级${this.fromType == 'shareholder' ? this.upAgent.agentName : this.customName.serviceProviderName}`);
      let shareImg = 'https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/common/provider.png';
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}&fromType=${this.fromType}`;
      if (this.fromType == 'shareholder' && localStorage.getItem("shareholderId")) {
        shareUrl += "&shareholderId=" + localStorage.getItem("shareholderId");
      }
      let shareDesc = this.isShowPartner ? "点击查看详情" : (this.upAgent.recruitShareDesc || "点击查看详情");
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    },
    goProductDetail(url, type) {
      if (!url || type == 0) {
        return;
      }
      if (this.upAgent.joinType == 1) {
        this.$routerGo(this, "push", {
          path: "/"
        });
      } else {
        utilJs.locationHref(url);
      }
    },
    clickNext() {
      if (this.upAgent.isFinish == 0) {
        return;
      }
      if (this.protocolInfo && this.isCheckAgreement == false) {
        this.$showCjToast({
          text: '请勾选协议',
          type: 'warn'
        });
        return;
      }
      if (this.upAgent.isOpenJoinAgent == 2) {
        this.sfValue = []
        // 获取最高级
        let vipType = Math.max.apply(Math, this.arrAgentName.map(item => {return item.vipType}))
        let valueItem = this.arrAgentName.filter((item) => {
          return item.vipType == vipType;
        })
        this.sfValue = [valueItem[0].name];
      }
      this.upAgent.isApply = 1;
    },
    clickOtherJion() {
      if (this.protocolInfo && this.isCheckAgreement == false) {
        this.$showCjToast({
          text: '请勾选协议',
          type: 'warn'
        });
        return;
      }
      this.otherJoinType = 1;
      this.getArrSubTypeName();
      utilJs.getMethod(`${global.apiurl}common/getAreaListForAgent`, res => {
        this.addressData = res.data;
        this.getApplyPage(0);
      }, failRes => {
      });
    },
    goAgentInfo() { //权益
      let url = this.fromType == "shareholder" ? '/homePage/agent/agentInfo?fromType=shareholder' : '/homePage/agent/agentInfo';
      this.$routerGo(this, "push", {path: url});
    }
  },
  activated() {
    isLoadding = false;
    let companyId = localStorage.getItem('companyId') || '';
    //谷晟阳和测试环境老鹰这个商家隐藏推广收益、团队管理，我的团队，团队业绩相关
    const HIDDEN_COMPANY_LIST = ['99yw', '8rxm'];
    this.isHiddenAgent = HIDDEN_COMPANY_LIST.includes(companyId);
    this.payMethod = [];
    //  this.addrValue = [];
    this.sfValue = [];
    this.agentConf = '';
    this.agentPrice = '';
    this.aaId = '';
    this.applyStatus = -1;
    this.isCancle = 0;
    this.selectAreaVal = 1
    this.subTypeArr = [];
    this.subType = [];
    this.formList = [];
    this.formArr = [];
    this.num = 60;
    this.yzText = "获取验证码";
    this.codeImgInfo = {};
    this.imgCode = '';
    this.code = '';
    this.hasSubType = false;
    this.isLoading = false;
    this.isShowCode = "";
    this.isYz = true;
    this.mobile = "";
    this.agent = "";
    this.otherJoinType = 0;
    this.isApplySuccess = false;
    this.showAllContent = false;
    this.isCheckAgreement = false;
    this.customName = JSON.parse(localStorage.getItem("customName"));
    this.isShowBtn = false;
    this.isShowFail = false;
    this.fromType = this.$route.query.fromType || '';
    this.protocolInfo = null;
    if (!this.fromType) {
      utilJs.getMethod(`${global.apiurl}protocols/getProtocolByProdType?prodType=42`, (res) => {
        this.protocolInfo = res.protocol && res.protocol.length > 0 ? res.protocol : null;
      });
    }
    this.arrAgentName = [];
    this.isMyLoadding = false;
    this.isMustInfo = false;
    this.isCardInfo = false;
    this.rShareholderId = '';
    this.rSName = '';
    this.shareholderMobile = '';
    this.isShowRenew = false;
    this.isDying = false;
    this.isPromotion = 0;
    if (this.fromType == "areaAgent") {
      utilJs.getMethod(`${global.apiurl}areaAgent/areaAgentIsApply`, res => {
        if (res.isApply == 1) { // 申请过区代，进到区代详情页
          this.$routerGo(this, "replace", {
            path: "/homePage/newAreaUser/oldAreaAgent",
            query: {
              comeFrom: 2,
            }
          })
        }
      })
    }
    let url = this.fromType == "shareholder" ? 'shareholder/userUpShareholder' : this.fromType == "areaAgent" ? 'areaAgent/userUpAreaAgent' : 'AgentUp/userUpAgent';
    utilJs.getMethod(`${global.apiurl}${url}`, res => {
      if (res.isOpenJoinAgent == 0 && res.isAgent == 0 && res.isApply == 0) { //沒有开启招募计划的如果不是服务商也显示招募计划
        res.isOpenJoinAgent = -1;
      }
      this.upAgent = res;
      if (this.fromType == "" && this.upAgent.isOpenJoinAgent == 2 && this.protocolInfo && this.upAgent.isAgent == 0) {
        this.$nextTick(() => {
          this.$refs.upgradeTip.style.paddingBottom = this.$refs.agreement.offsetHeight + 20 + "px" ;
        })
      }
      let recruitDesc = res.recruitDesc;
      if (recruitDesc && recruitDesc.substring(0, 4) == 'http' && recruitDesc.length > 5) {
        this.upAgent.recruitDesc = "";
        utilJs.getPageHtml(recruitDesc, sres => {
          for (let i = 0; i < res.replaceInfo.length; i++) {
            if (res.replaceInfo[i].replaceKey) {
              sres = sres.replace(new RegExp(res.replaceInfo[i].replaceKey, "gm"), res.replaceInfo[i].replaceValue);
            }
          }
          this.upAgent.recruitDesc = sres;
        });
      }
      if (this.upAgent && (this.upAgent.isAgent == 1 || this.upAgent.isApply == 1 || this.upAgent.isOpenJoinAgent == 0)) {
        setDocumentTitle(this.fromType == "shareholder" ? "股东中心" : this.fromType == "areaAgent" ? "区域代理" : this.customName.serviceProviderName);// eslint-disable-line
      } else {
        setDocumentTitle(res.recruitName != null ? res.recruitName : this.fromType == "shareholder" ? "股东中心" :  this.fromType == "areaAgent" ? "区域代理" : this.customName.serviceProviderName);// eslint-disable-line
      }
      if (!(res.isAgent == 0 && res.isOpenJoinAgent == 1 && res.isApply == 0 && res.isFinish == 0)) {
        this.isMyLoadding = true;
        this.getArrSubTypeName();
        utilJs.getMethod(`${global.apiurl}common/getAreaListForAgent`, ress => {
          this.addressData = ress.data;
          this.getApplyPage(1);
        }, failRes => {
          this.isMyLoadding = false;
        });
      }
      this.$nextTick(() => {
        this.wechatShare();
      });
    }, failRes => {
      this.wechatShare();
    });
    if (this.fromType == "") {
      this.custNameMap = utilJs.getCustNameMap();
    }
  },
  deactivated() {
    clearInterval(this.interval);
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.vux-cell-box:not(:first-child):before {
  border-top: none !important;
}
.base-red {
  color: #fa5e45;
}
.Quota-blue {
  color: #56adff;
}
.redeem-orange {
  color: #ff8237;
}
.present-orange {
  color: #5a80f8;
}
.quota-cost {
  color: #00d493;
}
::-webkit-input-placeholder {
  /* WebKit browsers */
  color: #999;
  font-size: 0.6rem;
  line-height: 0.85rem;
}
::-moz-placeholder {
  /* Mozilla Firefox 4 to 18 */
  color: #999;
}
::-moz-placeholder {
  /* Mozilla Firefox 19+ */
  color: #999;
}
::-ms-input-placeholder {
  /* Internet Explorer 10+ */
  color: #999;
}
.selectPicker >>> .weui-cell__ft,
.addressSelected >>> .weui-cell__ft {
  padding: 0 !important;
}
.selectPicker >>> .weui-cell,
.addressSelected >>> .weui-cell {
  padding: 0 !important;
}
.selectPicker >>> .weui-cell__ft:after,
.addressSelected >>> .weui-cell__ft:after {
  display: none !important;
}
.fc-f6 {
  color: #ccc;
}
.fc-xblack {
  color: #333 !important;
}
.masker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  z-index: 8;
  width: 100%;
  max-width: 16rem;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}
.content {
  width: 90%;
  position: fixed;
  margin: auto;
  top: 50%; left: 50%;
  -webkit-transform: translate(-50%,-50%);
  -ms-transform: translate(-50%,-50%);
  z-index: 9;
}
.dbg {
  width: 100%;
  max-width: 16rem;
  background: url('https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/public/i/wap/memberIndex/bg_blue_mb4.png') 0 0 no-repeat;
  background-size: contain;
}
.pbg {
  width: 9.4rem;
  height: 3.4rem;
  background: url('../../../assets/i/wap/newAreaAgent/agentPoster.png') 0 0 no-repeat;
  background-size: contain;
}
.qybg {
  width: 4.9rem;
  height: 3.4rem;
  background-image: url('../../../assets/i/wap/newAreaAgent/agentInfo.png');
  background-size: contain;
}
.agentBg {
  background-image: url('../../../assets/i/wap/newAreaAgent/agentBg.jpg');
  background-size: contain;
}
.result >>> .vux-cell-value {
  color:#333333 !important;
}
.box-shadow {box-shadow: 8px 5px 6px 10px rgba(0, 0, 0, 0.1)}
.pl130 {
  padding-left: 3.25rem;
}
.c-pb104 {
  padding-bottom: 2.6rem;
}
.bg-agent {
  background: #F5F7FA url(https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/public/i/wap/memberIndex/bg_blue_mb4.png) left top no-repeat;
  background-size: 100% 5rem;
}
.bg-agent-top {
  background: url('../../../assets/i/wap/newAreaAgent/agent-top-bg.png') left top no-repeat;
  background-size: 100% 100%;
}
.bg-agent-time {
  background: url('../../../assets/i/wap/newAreaAgent/time-bg.png') left top no-repeat;
  background-size: 100% 100%;
}
.invite-animation {
  animation: inviteAni 3s linear infinite;
  transform: translate3d(0, 0, 0);
}
@keyframes inviteAni {
  0% {
    width: 0.75rem;
  }
  8% {
    width: 0;
  }
  16% {
    width: 0.75rem;
  }
  100% {
    width: 0.75rem;
  }
}
</style>
